package cm.tl.pms.util;

import org.springframework.stereotype.Component;

/**
 * @author w7h1te_ywq
 * @version 1.0.0
 * @date 2024-01-12 18:50
 */
@Component
public class FileProcessor {

    public void processFile(String filePath) {

        String extension = getFileExtension(filePath);

        switch (extension) {
            case "txt":
                processTxtFile(filePath);
                break;

            case "jpg":
                processImageFile(filePath);
                break;

            case "pdf":
                processPdfFile(filePath);
                break;

            default:
                System.out.println("Unsupported file type");
        }
    }

    private String getFileExtension(String filename) {
        return filename.substring(filename.lastIndexOf(".") + 1);
    }

    private void processTxtFile(String filePath) {
        // 处理txt文件的逻辑
    }

    private void processImageFile(String filePath) {
        // 处理图片文件的逻辑
    }

    private void processPdfFile(String filePath) {
        // 处理pdf文件的逻辑
    }

}